package com.decent.ejfadmin.migration.controller;

import com.decent.ejfadmin.migration.entities.MigrationReportVO;
import com.decent.ejfadmin.migration.service.MigrationService;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 豆乐卡迁移外放接口管理
 * 1.收卡统计
 *
 * @author wangyx
 */
@Slf4j
@RestController
@RequestMapping("migration")
public class MigrationController {
    @Resource
    private MigrationService migrationService;

    /**
     * 1.收卡统计
     *
     * @param pageNumber 当前页数
     * @param pageSize   每页条数
     * @param startTime  查询开始时间
     * @param endTime    查询结束时间
     * @return list
     */
    @SuppressWarnings("JavadocReference")
    @RequestMapping("/report")
    public PageInfo<MigrationReportVO> queryDailyReport(PageInfo<MigrationReportVO> pageInfo, String startTime,
                                                        String endTime) {
        try {
            return migrationService.report(pageInfo, startTime, endTime);
        } catch (Exception e) {
            log.warn("销卡利润统计异常", e);
            return new PageInfo<>();
        }
    }
}
